#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

//    treewidget树控件使用
//    设置水平头
    ui->treeWidget->setHeaderLabels(QStringList() << "英雄" << "英雄介绍");

    QTreeWidgetItem * liItem = new QTreeWidgetItem(QStringList() << "力量");
    QTreeWidgetItem * minItem = new QTreeWidgetItem(QStringList() << "敏捷");
    QTreeWidgetItem * zlItem = new QTreeWidgetItem(QStringList() << "智力");
//    加载顶层节点
    ui->treeWidget->addTopLevelItem(liItem);
    ui->treeWidget->addTopLevelItem(minItem);
    ui->treeWidget->addTopLevelItem(zlItem);

//    添加子节点
    QStringList her;
    her << "1111" << "1111";
    QTreeWidgetItem * li = new QTreeWidgetItem(her);
    liItem->addChild(li);

}

Widget::~Widget()
{
    delete ui;
}

